package com.eight.cloud.message.runner;

import com.eight.cloud.message.listener.RedisListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

import static com.eight.cloud.openfeign.message.constant.SocketConstant.OPEN_API_CALLBACK;
import static com.eight.cloud.openfeign.message.constant.SocketConstant.WEBSOCKET_MESSAGE;

/**
 * @ClassName: RedisListenRunner
 * @Author: TXC
 * @Date: 2025-08-13 17:40
 **/
@Slf4j
@Component
public class RedisListenRunner implements ApplicationRunner {
    @Resource
    private RedisListener redisListener;

    /**
     * 开启ridis监听
     * @param args 应用参数
     */
    @Override
    public void run(ApplicationArguments args) {
        redisListener.subscribeToChannel(WEBSOCKET_MESSAGE);
        redisListener.subscribeToChannel(OPEN_API_CALLBACK);
    }
}
